Function: generateSelfSignedCertificate

CALL:

[keystore, keystorepassword, keymanagerpassword] = generateSelfSignedCertificate(directory)

DESCRIPTION:

Generate a selfsigned certificate to use https with the modelit.web.server.Server. This function generates the following files: cacerts.jks, server.cer and keystore.jks and saves them in the specified directory.

INPUT:

directory string
(optional) path where the keystore is saved. Default value: pwd.

OUTPUT:

keystore string
full path to the keystore.jks file
keystorepassword string
keystore password
keymanagerpassword string
keymanager password

USAGE any
[keystore, keystorepassword, keymanagerpassword] = generateSelfSignedCertificate()
hostname = 'localhost';
port = 8081;

% Create the https server.
server = modelit.web.server.Server(hostname, port, @(e)callback(e), keystore, keystorepassword, keymanagerpassword);
server = start(server);

% Create an HTTP Request (in another Matlab session) or with Postman or
from a browser.
request = modelit.web.client.HttpRequest('get','https://localhost:8081');
response = request.send();

REQUIRES any
keytool any
keytool is a tool to manage (public/private) security keys and certificates and store them in a Java KeyStore file (stored_file_name. jks).
It is provided with any standard JDK / JRE distributions. You can find it under the following folder %JAVA_HOME%\bin .